<template>
  <div>
    <input v-model="username" />
    <span>{{ msg }}</span>
  </div>
</template>

<script>
import axios from 'axios'
  export default {
    name: 'App',
    data() {
      return {
        username: '',
        msg:''
      }
    },
    // 侦听器函数
    watch: {
      async username(newVal) {
        // console.log(newVal)
        const { data: res} = await axios.get('http://www.itcbc.com:3006/api/finduser/' + newVal)
        // console.log(res);
        this.msg = res.message
      }
    }
  }
</script>